<?php
$section = "ADMIN";
$title = "Binder: Mass Update .. Use with caution."; 
 
require_once '../global.inc.php'; 


$userlevel = $_SESSION['userlevel']; 
$curuser = $_SESSION['USERID']; 


require_once INCLUDE_PATH . '/FQDN.class.php'; 
require_once INCLUDE_PATH . '/Records.class.php'; 

$objDom =& new FQDN();



$domlist = $objDom->fqdnList($curuser); 

$serverGroups = $objDom->groupOptions($userid); 


$tpl->assign("serverGroups",$serverGroups); 
$tpl->assign("dnsRecords",$domlist); 


#print_array($_POST);


$checkid = $_POST['checkid']; 
$numids = count($checkid); 

if(!empty($_POST)) { 
  echo "<div class='main'> Updating $numids domains <br> "; 

  for($i=0;$i<$numids;$i++) {
    $fqdnid = $checkid[$i]; 
    $groupid = $_POST['group_name']; 
    $newip = $_POST['newmultipleip'] ; 
#  echo "<li> Updating FQDN id $fqdnid ..."; 
    if(!empty($groupid)) {
   #   echo "Changing to $groupid <br>";
      $objDom->cascadeGroup($groupid,$fqdnid); 
      
    } else { 
      $objDns =& new DNSRecord(); 
      $intip = $objDns->mValidateIp($newip); 


    #  echo "Changing IP to : $intip <br> ";
      $objDom->cascadeIP($fqdnid,$intip); 
      header("Location: $web_base/admin/mass_update.php");        
    }

  }
}

#print_array($domlist);
$tpl->display('massupdate.html'); 







?>
